home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume89
/
fun
/
world.5
< prev
next >
Wrap
Text File
|
1989-02-02
|
58KB
|
2,653 lines
Path: xanth!ames!mailrus!ulowell!page
From: page@swan.ulowell.edu (Bob Page)
Newsgroups: comp.sources.amiga
Subject: v89i012: world - text adventure, Part05/07
Message-ID: <11528@swan.ulowell.edu>
Date: 2 Feb 89 05:05:14 GMT
Organization: University of Lowell, Computer Science Dept.
Lines: 2642
Approved: page@swan.ulowell.edu
Submitted-by: ejkst@unix.cis.pittsburgh.edu (Eric J. Kennedy)
Posting-number: Volume 89, Issue 12
Archive-name: fun/world.5
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# helper.c
# verbs1.c
# This archive created: Mon Jan 30 18:06:46 1989
cat << \SHAR_EOF > helper.c
#include <stdio.h>
#include "parame.inc"
#include "variab.h"
#include "arrays.h"
#include "qtext.inc"
#define abs(A) ((A < 0) ? -A : A)
#ifndef AMIGA
# define Q1TEXT "/usr/games/lib/q1text.dat"
#endif
/* World C Version 1.00 copyright 1987 J.D.McDonald
Use as you like for non-commercial purposes, but please
leave this note, and document any changes you make as yours */
static int start = 0;
int q1text_dat;
static int debugflg = 1;
static char filenm[] = "world.sav";
static short buffer[512];
static long filepos, oldpos;
speak(point)
int point;
{
/*
* this is the main routine to output text from the data file the word
* rtext(point) points to the proper record in the file
*/
int i, bi, t, kk;
long z;
if (start == 0) {
start += 1;
oldpos = -1;
#ifndef AMIGA /* q1text.dat already opened in wbstuff.c */
q1text_dat = open(Q1TEXT, 0);
#endif
}
z = (long) ((unsigned long) rtext[point]);
filepos = z * 2 & ~1023l;
if (filepos != oldpos) {
oldpos = filepos;
lseek(q1text_dat, filepos, 0);
read(q1text_dat, buffer, 512*sizeof(short));
}
bi = z & 511;
do {
kk = 0;
while (1) {
if (bi == 512) {
oldpos += 1024;
lseek(q1text_dat, oldpos, 0);
read(q1text_dat, buffer, 512*sizeof(short));
bi = 0;
}
t = buffer[bi];
z++;
bi++;
if (t < 0) {
t = -t;
outst2[kk++] = t & 127;
outst2[kk++] = t >> 8;
} else {
outst2[kk++] = (t % 32) + 96;
outst2[kk++] = ((t >> 5) % 32) + 96;
outst2[kk++] = t / 1024 + 96;
if (outst2[kk - 3] == '{') {
kmax = kk - 4;
break;
}
}
if (outst2[kk - 2] == '{') {
kmax = kk - 3;
break;
} else if (outst2[kk - 1] == '{') {
kmax = kk - 2;
break;
}
}
for (i = 0; i <= kmax; i++) {
if (outst2[i] == '`')
outst2[i] = ' ';
if (outst2[i] == '|')
outst2[i] = '.';
}
if (wwflag == 0)
linout(outst2, kmax + 1);
} while (z < rtext[point + 1]);
}
vlocat(i, h)
int i, h;
{
int k, p, r, nowir, xloc, xturn;
/*
* code for "l" or "locate" but NOT "look" gtext(2) points to short
* descriptions in the location area of the text file, while gtext(1)
* points to the long ones
*/
if (brfflg == 2 || i == 1 || ((locdat[loc] & 16384) == 0
&& brfflg != 0) || (loc >= 101 && loc <= 116))
xloc = loc + gtext[1];
else
xloc = loc + gtext[2];
speak(xloc);
if (loc == 89) {
if (easttm == 0) {
speak(372);
eastsc |= 1;
} else if (easttm > 0 && easttm <= 50) {
speak(373);
eastsc |= 2;
} else if (easttm == 51)
speak(374);
else {
speak(375);
eastsc |= 4;
}
}
xturn = turns % 100;
if (turns < 8)
xturn = 8;
if (h == 0)
return;
/* this section prints out the objects at "loc" */
for (k = 1; k <= OBJMAX; k++) {
p = obimpr[k];
if (!((k <= MOVMAX && obloc[k] != loc) ||
(k > MOVMAX && (obw3[k] != loc && obw4[k] != loc)) ||
(k == HPUCK && loc == 38 && marflg[1]))) {
r = (p / 8) % 8;
if (r >= 1) {
if ((p & 1) == 1)
speak(odistb[k] + r);
}
if (!(obpprp[k] / 2048 == 0 && k != ZROBOT))
xcontn(k);
} continue;
}
/* standing on something? */
if (spcloc == 1)
speak(212);
if (spcloc == 2) {
if (dirty == 0)
speak(509);
else
speak(510);
}
/* is the wire lying on the ground */
nowir = 1;
for (i = 0; i < 6; i++) {
if (wirelc[i] == loc)
nowir = 0;
}
if (nowir == 0)
speak(215);
if ((loc == 76 || loc == 77 || loc == 79) && obloc[ZCAT] ==
80)
speak(280);
/* flowers following sun */
if (loc == 86 && xturn > 6 && xturn < 69 && obimpr[ZSEED] > 4000)
speak(341);
/* vine describe */
if (loc == 74 && obimpr[ZVINE] == 9) {
speak(339);
obimpr[ZVINE] = 8201;
} else if (loc == 74 && obimpr[ZVINE] == 8201)
speak(259);
}
vinven()
/* "inventory" */
{
int carryn, wearn, i, k;
carryn = 0;
wearn = 0;
if (wirelc[5] == 1000)
carryn = 1;
for (i = 1; i <= MOVMAX; i++) {
if (obloc[i] == 1000)
carryn = 1;
if (obloc[i] == 3000)
wearn = 1;
}
if (carryn == 1) {
speak(62);
xindnt += 2;
if (wirelc[5] == 1000)
speak(256);
for (k = 1; k <= MOVMAX; k++) {
if (obloc[k] != 1000)
continue;
speak(odistb[k]);
if (obpprp[k] / 2048 != 0)
xcontn(k);
}
xindnt -= 2;
}
if (wearn == 1) {
speak(63);
xindnt += 2;
for (k = 1; k <= MOVMAX; k++) {
if (obloc[k] != 3000)
continue;
speak(odistb[k]);
if (obpprp[k] / 2048 != 0)
xcontn(k);
}
xindnt -= 2;
}
if (carryn == 0 && wearn == 0)
speak(64);
nonext = 1;
}
xcontn(k) /* RECURSIVE FUNCTION */
int k;
{
int p, empty, k1;
/*
* list contents of a container
* calls itself recursively to list things inside other containers
*/
/* RECURSIVE FUNCTION */
if (k == LFUNNE || k == MFUNNE || k == RFUNNE)
return;
p = obimpr[k];
if ((p & 2) == 0 || (obpprp[k] & 128) == 0) {
empty = 1;
for (k1 = 1; k1 <= MOVMAX; k1++)
if (obloc[k1] == k + 2000)
empty = 0;
if (empty) {
xindnt += 2;
speak(odistb[k] + ((p / 512) % 8));
xindnt -= 2;
} else {
xindnt += 2;
speak(odistb[k] + ((p / 512) % 8) + 1);
xindnt += 2;
for (k1 = 1; k1 <= MOVMAX; k1++) {
if (obloc[k1] == k + 2000) {
speak(odistb[k1]);
if (obpprp[k1] / 2048 != 0)
xcontn(k1);
}
}
xindnt -= 4;
}
} else if ((p & 2) != 0 && (obpprp[k] & 128) != 0 && prepdo == IN)
speak(386);
}
dbg()
{
char tmpstrq[80];
if(debugflg == 0) return;
debugflg = 2;
printf(" loc is %5d \n", loc);
printf(" enter new loc ");
gets(tmpstrq);
sscanf(tmpstrq,"%d", &loc);
}
scorng()
{
int result, i, q, v, l, n, plce, xplc;
result = 0;
if (loc >= 153)
return (0);
result = (diesc - 3) * 2;
if (result < 0)
result = 0;
if (cactsc == 1 || cactsc == 2)
result += 2;
if (cactsc == 3)
result += 4;
if ((eastsc & 1) != 0)
result += 2;
if ((eastsc & 2) != 0)
result += 2;
if ((eastsc & 4) != 0)
result += 2;
if(debugflg == 2)
printf(" east+cact %5d out of 10\n",result);
for (i = 1; i <= MOVMAX; i++) {
q = obw4[i];
v = q / 4096;
l = q - v * 4096;
if (v == 0)
continue;
n = 0;
itsher(i, &plce);
if (i == GDISC) {
if (plce != 0 && rvtim == 2)
n = v;
} else if (l >= 4000 && l - 4000 != obloc[i])
n = v;
else if (l == 3000 && obloc[i] == 3000)
n = v;
else if (l == 1000 && (plce == 1 || plce == 3))
n = v;
else if (l == 3000 && (plce == 1 || plce == 3))
n = v / 2;
else if (l < 1000 && l == obloc[i])
n = v;
else if (l > 2000 && l < 3000 && obloc[i] == l) {
itsher((l - 2000), &xplc);
if (xplc > 0 && xplc <= 3)
n = v;
}
result += n;
if(debugflg == 2)printf("obj %5d %5d points out of %5d\n",i,n,v);
}
if (deadf)
result -= 5;
if (result < 0)
result = 0;
result *= 5;
return (result);
}
getrob(don, doa)
int don, doa;
{
int result, i;
/*
* search table for object return object number if found and unambiguous
* return 0 if not found return -1 if ambiguous
*/
for (i = 1; i <= OBJMAX; i++) {
if (don != obnoun[i])
continue;
if ((doa == abs(obadjv[i])) || (doa == 0 && obadjv[i] < 0))
return (i);
else if (doa == 0 && obadjv[i] > 0)
result = -1;
else
result = 0;
}
return (result);
}
static char sstring[] =
"Your score is out of a total of in turns.";
static int breakp[] = {0, 35, 70, 90, 130, 170, 210, 260, 330,
380, 450, 900};
scorpt(scor, mxsc)
int scor, mxsc;
{
char cnum[4];
int i;
numcvt(scor, cnum);
sstring[14] = cnum[1];
sstring[15] = cnum[2];
sstring[16] = cnum[3];
numcvt(mxsc, cnum);
sstring[36] = cnum[1];
sstring[37] = cnum[2];
sstring[38] = cnum[3];
numcvt(turns, cnum);
sstring[43] = cnum[0];
sstring[44] = cnum[1];
sstring[45] = cnum[2];
sstring[46] = cnum[3];
linout(sstring, 54);
for (i = 0; i < 10; i++) {
if (scor >= breakp[i] && scor < breakp[i + 1])
break;
}
speak(481 + i);
}
numcvt(num, cnum)
int num;
char *cnum;
{
int lx, m;
m = num / 1000;
lx = (m) ? '0' + m : ' ';
*cnum++ = lx;
m = (num / 100) % 10;
lx = (m == 0 && lx == ' ') ? ' ' : '0' + m;
*cnum++ = lx;
m = (num / 10) % 10;
lx = (m == 0 && lx == ' ') ? ' ' : '0' + m;
*cnum++ = lx;
m = num % 10;
*cnum = '0' + m;
}
robdsc()
{
int rempty, lempty, k;
if (obloc[ZROBOT] >= 90 && obloc[ZROBOT] <= 95)
speak(gtext[1] + obloc[ZROBOT]);
else
speak(226 + obloc[ZROBOT]);
rempty = 1;
lempty = 1;
for (k = 1; k <= MOVMAX; k++) {
if (obloc[k] == 2000 + ZROBOT)
rempty = 0;
if (obloc[k] == obloc[ZROBOT] && k != ZROBOT)
lempty = 0;
}
if (rempty == 0) {
speak(odistb[ZROBOT] + 5);
for (k = 1; k <= MOVMAX; k++) {
xindnt += 2;
if (obloc[k] == 2000 + ZROBOT)
speak(odistb[k]);
xindnt -= 2;
}
}
if (lempty == 0) {
speak(350);
for (k = 1; k <= MOVMAX; k++) {
xindnt += 2;
if (k != ZROBOT && obloc[k] == obloc[ZROBOT])
speak(odistb[k]);
xindnt -= 2;
}
}
if (obloc[ZROBOT] == 90 && (obloc[ZORCHI] == 2000 + ZROBOT
|| obloc[ZFLYTR] == 2000 + ZROBOT))
speak(353);
}
endsl()
{
#ifdef AMIGA
ttclose(); /* dummy routine to maybe clear screen? */
#endif
}
vdead()
{
int i;
/*
* "you're dead,fred" it is incumbent on the calling routine to get to
* where the body is supposed to lie, and to set oldloc and oldlc2 to
* ,usually, 0 this routine sets deadf to .true. and drops all his
* possessions where he is now
*/
eattim = 0;
rdietm = 0;
deadf = 1;
for (i = 1; i <= MOVMAX; i++)
if (obloc[i] == 1000 || obloc[i] == 3000)
obloc[i] = loc;
if (loc < 153)
speak(55);
else
speak(552);
nonext = 1;
eolflg = 1;
spcloc = 0;
for (i = 0; i < 6; i++)
if (wirelc[i] == 1000)
wirelc[i] = loc;
if (wirelc[0] != obloc[ZWIRE])
return;
for (i = 0; i < 6; i++)
wirelc[i] = 0;
diesc += 1;
}
itsher(objt, plce)
int objt;
int *plce;
{
int n1;
/*
* this subroutine tells if an object is either: being carried plce=1
* being worn plce=2 inside something being carried,and not hidden
* from view (3) at "loc" and not hidden (4) inside something at loc (5)
*/
*plce = 0;
if (objt <= MOVMAX) {
if (obloc[objt] == 1000)
*plce = 1;
else if (obloc[objt] == 3000)
*plce = 2;
else if (obloc[objt] == loc && (obimpr[objt] & 1) == 1)
*plce = 4;
else if (obloc[objt] > 2000 && obloc[objt] < 3000) {
n1 = obloc[objt] - 2000;
if (n1 <= MOVMAX) {
if ((obloc[n1] == 1000 || obloc[n1] == 3000)
&& (obimpr[n1] & 2) == 0)
*plce = 3;
else if (obloc[n1] == loc && ((obimpr[n1] & 1) == 1)
&& ((obimpr[n1] & 2) == 0))
*plce = 5;
else;
} else if ((obw3[n1] == loc || obw4[n1] == loc) &&
((obimpr[n1] & 1) == 1) && ((obimpr[n1] & 2) == 0))
*plce = 5;
else;
} else;
} else if ((obw3[objt] == loc || obw4[objt] == loc) &&
((obimpr[objt] & 1) == 1))
*plce = 4;
}
burden(ncarrd, nweigh, kcarrd, kweigh)
int *ncarrd, *nweigh, *kcarrd, *kweigh;
{
int i;
/*
* calculate weight and number of objects on adventurer and in knapsack
*/
*ncarrd = 0;
*nweigh = 0;
for (i = 1; i <= MOVMAX; i++) {
if (obloc[i] != 1000)
continue;
*ncarrd += 1;
*nweigh += obw3[i] / 256;
}
*kcarrd = 0;
*kweigh = 0;
for (i = 1; i <= MOVMAX; i++) {
if (i == ZKNAPS || obloc[i] != (2000 + ZKNAPS))
continue;
*kcarrd += 1;
*kweigh += obw3[i] / 256;
}
}
getobj(don, doa)
int don, doa;
{
/*
* search table for object return object number if found and unambiguous
* return 0 if not found return -1 if ambiguous
*/
int result, i, g1, g2, ggg, ddd, sum;
int aplce, bplce, cplce, dplce, fplce, gplce, mplce, nplce, oplce, pplce;
int splce, tplce;
result = 0;
for (i = 1; i <= OBJMAX; i++) {
if (don != obnoun[i])
continue;
if ((doa == abs(obadjv[i]) && doa != BEAUTI && doa !=
VENDIN) || (doa == 0 && obadjv[i] < 0)) {
result = i;
return (result);
} else if ((doa == 0 && obadjv[i] > 0) || (doa == VENDIN &&
don == MACHIN) || (doa == BEAUTI && don == BIRD)) {
if (don == FISH) {
if (obloc[CFISH] != 0)
result = CFISH;
else
result = DFISH;
} else if (don == PANTS) {
itsher(RPANT, &g1);
itsher(LPANT, &g2);
if (g1 != 0 && g2 == 0)
result = RPANT;
else if (g1 == 0 && g2 != 0)
result = LPANT;
else if ((wrdnum[0] == TAKE && prepdo == OFF) ||
wrdnum[0] == REMOVE) {
if (g1 == 2)
result = RPANT;
else
result = LPANT;
} else if (wrdnum[0] == DROP)
if (((g1 == 1) || (g1 == 3)) && g2 != 1 && g2 != 3)
result = RPANT;
if (((g2 == 1) || (g2 == 3)) && g1 != 1 && g1 != 3)
result = LPANT;
else
result = -1;
} else if (don == SHIRT) {
itsher(RSHIRT, &g1);
itsher(GSHIRT, &g2);
if (g1 != 0 && g2 == 0)
result = RSHIRT;
else if (g1 == 0 && g2 != 0)
result = GSHIRT;
else if ((wrdnum[0] == TAKE && prepdo == OFF) ||
wrdnum[0] == REMOVE) {
if (g1 == 2)
result = RSHIRT;
else
result = GSHIRT;
} else if (wrdnum[0] == DROP) {
if (((g1 == 1) || (g1 == 3)) && g2 != 1 && g2 != 3)
result = RSHIRT;
if (((g2 == 1) || (g2 == 3)) && g1 != 1 && g1 != 3)
result = GSHIRT;
} else
result = -1;
} else if (don == DOOR) {
if (loc == 41 || loc == 135)
result = MDOOR;
else if (loc == 85 || loc == 136)
result = GDOOR;
else if (loc == 47 || loc == 51)
result = RDOOR;
else if (loc == 165 || loc == 166)
result = ODOOR;
else if (loc == 173)
result = PDOOR;
else if (loc == 175)
result = BDOOR;
else
result = -1;
} else if (don == CARTRI) {
itsher(ZCART, &tplce);
itsher(CCART, &cplce);
if (tplce > 0 && cplce <= 0)
result = ZCART;
else if (tplce <= 0 && cplce > 0)
result = CCART;
else
result = -1;
} else if (don == PHOTOG) {
itsher(PPHOTO, &pplce);
itsher(MPHOTO, &mplce);
itsher(OPHOTO, &oplce);
itsher(APHOTO, &aplce);
itsher(FPHOTO, &fplce);
pplce = (pplce < 1) ? pplce : 1;
mplce = (mplce < 1) ? mplce : 1;
oplce = (oplce < 1) ? oplce : 1;
aplce = (aplce < 1) ? aplce : 1;
fplce = (fplce < 1) ? fplce : 1;
sum = pplce + mplce + oplce + aplce + fplce;
{
if (sum == 0)
result = 0;
else if (sum > 1)
result = -1;
else {
if (pplce != 0)
result = PPHOTO;
if (mplce != 0)
result = MPHOTO;
if (oplce != 0)
result = OPHOTO;
if (aplce != 0)
result = APHOTO;
if (fplce != 0)
result = FPHOTO;
}
}
} else if (don == BIRD) {
if (loc == 65 || loc == 66)
result = RBIRD;
else if (loc == 78 || loc == 79)
result = XBIRD;
else if (loc == 77 || loc == 80)
result = YBIRD;
else if (loc == 75 || loc == 76)
result = ZBIRD;
else
result = 0;
} else if (don == BUTTON) {
if (loc == 146 || loc == 134)
result = -1;
else if (loc == 143)
result = RDBUTT;
else if (loc == 169)
result = GBUTTO;
else
result = 0;
} else if (don == CABLE || don == DISC) {
if (don == CABLE) {
ddd = DCABLE;
ggg = GCABLE;
} else {
ddd = BDISC;
ggg = GDISC;
}
itsher(ddd, &dplce);
itsher(ggg, &gplce);
if (dplce == 0 && gplce == 0)
result = 0;
else {
if (wrdnum[0] == DROP) {
if ((dplce == 1 || dplce == 3) && (gplce != 1
&& gplce != 3))
result = ddd;
else if ((gplce == 1 || gplce == 3) &&
(dplce != 1 && dplce != 3))
result = ggg;
else
result = -1;
} else if (wrdnum[0] == TAKE) {
if ((dplce == 4 || dplce == 5) && (gplce != 4
&& gplce != 5))
result = ddd;
else if ((gplce == 4 || gplce == 5) &&
(dplce != 4 && dplce != 5))
result = ggg;
else
result = -1;
} else {
if (gplce == 0 && dplce != 0)
result = ddd;
else if (dplce == 0 && gplce != 0)
result = ggg;
else
result = -1;
}
}
} else if (don == MACHIN) {
if (loc == 153)
result = PMACH;
else if (loc == 156)
result = TMACH;
else if (loc == 158)
result = NMACH;
else if (loc == 160)
result = SMACH;
else if (loc == 162)
result = MMACH;
} else if (don == SLOT) {
if (loc == 146)
result = RSLOT;
else if (loc == 156)
result = TSLOT;
else if (loc == 158)
result = NSLOT;
else if (loc == 160)
result = SSLOT;
else if (loc == 162)
result = MSLOT;
} else if (don == COIN) {
if (loc < 153)
result = SCOIN;
else {
itsher(SCOIN, &splce);
itsher(BCOIN, &bplce);
itsher(CCOIN, &cplce);
itsher(NCOIN, &nplce);
itsher(PCOIN, &pplce);
pplce = (pplce < 1) ? pplce : 1;
nplce = (nplce < 1) ? nplce : 1;
cplce = (cplce < 1) ? cplce : 1;
bplce = (bplce < 1) ? bplce : 1;
splce = (splce < 1) ? splce : 1;
sum = pplce + nplce + cplce + bplce + splce;
if (sum == 0)
result = 0;
else if (sum > 1)
result = -1;
else {
if (splce != 0)
result = SCOIN;
if (bplce != 0)
result = BCOIN;
if (cplce != 0)
result = CCOIN;
if (nplce != 0)
result = NCOIN;
if (pplce != 0)
result = PCOIN;
}
}
} else
result = -1;
return (result);
}
}
return (result);
}
static char strng1[] = " I can't do that to item on your list.";
static char strng2[] = " Item number on your list is ambiguous";
cnvobj()
{
char cnum[4];
int result, many, i, k, n, p, z;
/*
* this routine searches the list of objects and compares with the list
* of d.o.'s if an object exists and is unambiguous it's entry in dobjs
* is replaced by its object number otherwise its entry in dobjs is set
* to zero the entries in dobsj are then squeezed up if the result was
* totally unambiguous cnvobj is .true.
*/
result = 1;
n = 0;
if (allflg)
n = 1;
many = 0;
if ((butflg && dobjs[2] != 0) || ((!butflg) &&
dobjs[1] != 0))
many = 1;
k = 0;
z = -1;
for (i = n; i < 12; i++) {
k += 1;
if (dobjs[i] == 0)
break;
p = getobj(dobjs[i], doadjs[i]);
if (p > 0) {
z += 1;
dobjs[z] = p;
} else if (p == 0) {
if (many == 1) {
numcvt(k, cnum);
strng1[28] = cnum[2];
strng1[29] = cnum[3];
linout(strng1, 44);
} else
speak(422);
} else {
result = 0;
if (many == 1) {
numcvt(k, cnum);
strng2[16] = cnum[2];
strng2[17] = cnum[3];
linout(strng2, 44);
} else
speak(70);
speak(250);
}
}
while (++z < 30)
dobjs[z] = 0;
return (result);
}
getall()
{
int temp[30], i, k, d, m;
/*
* routine to get "all" or "all but" objects it only works on moveable
* objects because the only verbs which call it work only on those
* objects (drop,take, put)
*/
for (i = 0; i < 30; i++) {
temp[i] = dobjs[i];
dobjs[i] = 0;
}
k = 0;
for (i = 1; i <= MOVMAX; i++) {
itsher(i, &d);
if (d == 0)
continue;
for (m = 0; m < 30; m++)
if (temp[m] == i)
goto endloop;
if (k == 29) {
speak(106);
return;
}
dobjs[k++] = i;
endloop:
;
}
}
rdinit()
{
long t;
long tloc;
long time();
int ti;
t = time(&tloc);
ti =( (int) t) & 32767;
srand(ti);
}
qrand()
{
return ((rand() & 16383) / 4);
}
pct(q)
int q;
{
int j;
j = rand();
return ((q * 327) > (j & 32767));
}
yesx(spk)
int spk;
{
char ans[90];
/* ask question, and wait for reply from him */
speak(spk);
more = 0;
while (1) {
linout("?", 2001);
gets(ans);
more = 1;
if (strcmp(ans, "Y") == 0 || strcmp(ans, "YES") == 0
|| strcmp(ans, "y") == 0 || strcmp(ans, "yes") == 0)
return (1);
else if (strcmp(ans, "N") == 0 || strcmp(ans, "NO") == 0
|| strcmp(ans, "n") == 0 || strcmp(ans, "no") == 0)
return (0);
else
speak(102);
}
}
getln()
{
/* write a prompt, then read a line from the terminal */
int i, lastpos;
linout("> ", 7001);
gets(inbuf);
eolflg = 0;
lastpos = strlen(inbuf);
lastpos = (lastpos > 78) ? 78 : lastpos;
for (i = lastpos; i < 83; i++)
inbuf[i] = '.';
more = 1;
inbuf[127] = (char)lastpos;
}
carerr(x, z)
int x, z;
{
/*
* this nifty routine put a caret on the terminal at the indicated
* position of a line and then outputs a message
*/
/* if not the first sentence on a line, rewrite line. */
if (clause != 1) {
linout(" ", 1001);
linout(inbuf, inbuf[127]);
}
if (x > 0) {
xindnt = x;
linout("^", 1);
xindnt = 0;
} else {
if (clause != 1) {
xindnt = lptr - 1;
linout("*", 1);
xindnt = 0;
speak(423);
}
}
speak(z);
}
linout(ustring, num)
char *ustring;
int num;
{
int num1, i;
char buff[80];
char *cptr;
cptr = buff;
num1 = num % 1000;
for (i = 0; i < xindnt; i++)
*cptr++ = ' ';
for (i = 0; i < num1; i++)
*cptr++ = *ustring++;
*cptr++ = '\0';
if (num < 1000) {
if(more == 19 && nomor == 0) {
i = strlen(buff);
for( ; i < 73; i++)
buff[i] = ' ';
strcpy(&buff[73],"MORE");
printf("%1s", buff);
gets(buff);
more = 0;
}
else {
printf("%1s\n", buff);
more += 1;
}
}
else
printf("%1s", buff);
}
vsuspe(inout)
int inout;
{
short sbuffer[256];
int result, filedes, i, iret;
short *sbptr, *iptr;
result = 0;
if (inout != 1) {
/* "suspend" or "save" */
filedes = creat(filenm, 0600);
if (filedes == -1) {
linout("I failed to create your save file.", 34);
return (result);
}
sbptr = sbuffer;
*sbptr++ = horflg;
for (i = 0; i < 6; i++)
*sbptr++ = wirelc[i];
*sbptr++ = turns;
*sbptr++ = loc;
*sbptr++ = oldloc;
*sbptr++ = oldlc2;
*sbptr++ = brfflg;
*sbptr++ = deadf;
*sbptr++ = dirty;
*sbptr++ = nonext;
*sbptr++ = spcloc;
*sbptr++ = fshlif;
*sbptr++ = noshoe;
*sbptr++ = daytim;
*sbptr++ = martim;
for (i = 0; i < 9; i++)
*sbptr++ = marflg[i];
*sbptr++ = oextim;
*sbptr++ = rdietm;
*sbptr++ = rvtim;
*sbptr++ = gvtim;
*sbptr++ = eattim;
*sbptr++ = easttm;
*sbptr++ = filmtm;
*sbptr++ = screef;
*sbptr++ = eastsc;
*sbptr++ = cactsc;
*sbptr++ = diesc;
*sbptr++ = filmst;
*sbptr++ = machst;
*sbptr++ = dial1;
*sbptr++ = dial2;
*sbptr++ = dial1x;
*sbptr++ = dial2x;
*sbptr++ = bonus;
*sbptr++ = jackpo;
*sbptr++ = lpill;
*sbptr++ = pbstat;
*sbptr++ = decset;
*sbptr++ = raset;
*sbptr++ = dcombi;
*sbptr++ = chaset;
*sbptr++ = guardl;
*sbptr++ = fimage;
write(filedes, sbuffer, 64*sizeof(short));
sbptr = sbuffer;
iptr = locdat;
for (i = 0; i <= LOCNUM; i++)
*sbptr++ = *iptr++;
write(filedes, sbuffer, 256*sizeof(short));
sbptr = sbuffer;
iptr = obimpr;
for (i = 0; i <= OBJMAX; i++)
*sbptr++ = *iptr++;
write(filedes, sbuffer, 256*sizeof(short));
sbptr = sbuffer;
iptr = obloc;
for (i = 0; i <= OBJMAX; i++)
*sbptr++ = *iptr++;
write(filedes, sbuffer, 256*sizeof(short));
close(filedes);
return (result);
} else {
/* "restore" */
filedes = open(filenm, 0);
if (filedes == -1)
goto lab1;
iret = read(filedes, sbuffer, 64*sizeof(short));
if (iret != 64*sizeof(short))
goto lab1;
sbptr = sbuffer;
horflg = *sbptr++;
for (i = 0; i < 6; i++)
wirelc[i] = *sbptr++;
turns = *sbptr++;
loc = *sbptr++;
oldloc = *sbptr++;
oldlc2 = *sbptr++;
brfflg = *sbptr++;
deadf = *sbptr++;
dirty = *sbptr++;
nonext = *sbptr++;
spcloc = *sbptr++;
fshlif = *sbptr++;
noshoe = *sbptr++;
daytim = *sbptr++;
martim = *sbptr++;
for (i = 0; i < 9; i++)
marflg[i] = *sbptr++;
oextim = *sbptr++;
rdietm = *sbptr++;
rvtim = *sbptr++;
gvtim = *sbptr++;
eattim = *sbptr++;
easttm = *sbptr++;
filmtm = *sbptr++;
screef = *sbptr++;
eastsc = *sbptr++;
cactsc = *sbptr++;
diesc = *sbptr++;
filmst = *sbptr++;
machst = *sbptr++;
dial1 = *sbptr++;
dial2 = *sbptr++;
dial1x = *sbptr++;
dial2x = *sbptr++;
bonus = *sbptr++;
jackpo = *sbptr++;
lpill = *sbptr++;
pbstat = *sbptr++;
decset = *sbptr++;
raset = *sbptr++;
dcombi = *sbptr++;
chaset = *sbptr++;
guardl = *sbptr++;
fimage = *sbptr++;
iret = read(filedes, sbuffer, 256*sizeof(short));
if (iret != 256*sizeof(short))
goto lab1;
sbptr = sbuffer;
iptr = locdat;
for (i = 0; i <= LOCNUM; i++)
*iptr++ = *sbptr++;
iret = read(filedes, sbuffer, 256*sizeof(short));
if (iret != 256*sizeof(short))
goto lab1;
sbptr = sbuffer;
iptr = obimpr;
for (i = 0; i <= OBJMAX; i++)
*iptr++ = *sbptr++;
iret = read(filedes, sbuffer, 256*sizeof(short));
if (iret != 256*sizeof(short))
goto lab1;
sbptr = sbuffer;
iptr = obloc;
for (i = 0; i <= OBJMAX; i++)
*iptr++ = *sbptr++;
close(filedes);
result = 1;
chaser = 0;
linout(" ", 1);
return (result);
}
lab1:
linout("Restore failed.", 15);
return (result);
}
SHAR_EOF
cat << \SHAR_EOF > verbs1.c
#include "parame.inc"
#include "variab.h"
#include "arrays.h"
/* World C Version 1.00 copyright 1987 J.D.McDonald
Use as you like for non-commercial purposes, but please
leave this note, and document any changes you make as yours */
vattac()
{
int i, spk, cplce, n, plce;
/*
* "attach" or "tie" not "attack" a mess since it involves the wire
*/
if (dobjs[0] == CABLE && iobj == ANTENN) {
if (loc != 69)
spk = 379;
else if (obloc[GCABLE] == 2000 + ZANTEN || obloc[DCABLE] == 2000 + ZANTEN)
spk = 381;
else {
n = getobj(dobjs[0], doadjs[0]);
if (n <= 0)
spk = 70;
else {
itsher(n, &cplce);
if (cplce != 1 && cplce != 3 && cplce != 4)
spk = 380;
else {
obloc[n] = 2000 + ZANTEN;
spk = 75;
}
}
}
} else if (dobjs[0] != WIRE)
spk = 48;
else if (iobj == TREE || iobj == LOG || iobj == STOOL)
spk = 204;
else if (iobj != KNOB && iobj != TOWER)
spk = 48;
else {
itsher(ZWIRE, &plce);
if (plce == 0)
spk = 213;
else if (iobj == TOWER) {
if (loc != 48)
spk = 205;
else {
spk = 75;
obloc[ZWIRE] = loc;
/* -57=177707 octal */
obimpr[ZWIRE] = (obimpr[ZWIRE] & -57) + 24;
for (i = 0; i < 6; i++)
wirelc[i] = 1000;
}
} else {
if (loc != 42)
spk = 206;
else if (spcloc == 1) {
spk = 75;
obloc[ZWIRE] = loc;
/* ~56=177707 octal */
obimpr[ZWIRE] = (obimpr[ZWIRE] & ~56) + 32;
for (i = 0; i < 6; i++)
wirelc[i] = 1000;
} else
spk = 207;
}
}
speak(spk);
}
vattak()
{
int spk;
spk = 286;
if (dobjs[0] == VINE && loc == 74 && (obimpr[ZVINE] & 56) == 8) {
spk = 306;
if (pct(33))
spk = 302;
else if (pct(50))
spk = 305;
} else if (dobjs[0] == GUARD) {
if (loc == guardl || loc == 171 || (chaset != 0 && chaset <= 9))
spk = 562;
else
spk = 561;
} else if (dobjs[0] == MARTIA && loc >= 27 && loc <= 51)
spk = 307;
else if (dobjs[0] == ROBOT || dobjs[0] == FERRET)
spk = 285;
speak(spk);
}
vbreak()
{
int j, hplce, xplce;
if (iobj != 0 && iobj != HAMMER && iobj != BOULDE) {
speak(48);
return;
}
if (iobj == HAMMER) {
itsher(ZHAMME, &hplce);
if (hplce == 0) {
speak(329);
return;
}
}
if (iobj == BOULDE) {
speak(330);
return;
}
if (dobjs[0] == LOUVER && (loc == 98 || loc == 142)) {
speak(282);
obimpr[ZLOUVE] = 9;
if (iobj == HAMMER)
obloc[ZHAMME] = 1000;
return;
}
if (dobjs[0] == FERRET || dobjs[0] == ROBOT || dobjs[0] ==
MARTIA || dobjs[0] == CAT || dobjs[0] == FISH) {
speak(286);
return;
}
if (dobjs[0] == GUARD) {
if (loc == guardl || loc == 171 || (chaset != 0 && chaset <= 9))
speak(562);
else
speak(561);
return;
}
j = getobj(dobjs[0], doadjs[0]);
if (j == -1) {
speak(70);
return;
} else {
itsher(j, &xplce);
if (xplce == 0)
speak(66);
else if (j > MOVMAX)
speak(332);
else if (dobjs[0] == WIRE || dobjs[0] == KNAPSA || dobjs[0] ==
SHIRT || dobjs[0] == PANTS || dobjs[0] == BOULDE ||
dobjs[0] == PUCK || dobjs[0] == LATEX || dobjs[0] ==
NUGGET || dobjs[0] == KNIFE || dobjs[0] == BEAD) {
speak(48);
return;
} else if ((dobjs[0] == KEY || dobjs[0] == SAPPHI || dobjs[0] ==
DIAMON || dobjs[0] == SPHERE) && iobj != HAMMER)
speak(385);
else if (j == ZSEED) {
if (loc != 131 && loc != 99 && loc != 100) {
speak(337);
obimpr[ZSEED] = 0;
} else if (loc != 100) {
speak(338);
obimpr[ZSEED] = 0;
} else {
speak(340);
obimpr[ZSEED] = 3;
/* seed function here */
}
obloc[ZSEED] = 0;
} else if (j == ZSTATU && loc == 99 && obloc[j] == 99)
speak(89);
else if (j == CEGG) {
speak(480);
obloc[CEGG] = 0;
obloc[SCOIN] = loc;
} else {
speak(331);
if (j == GSPHER) {
speak(333);
obloc[ZBEAD] = obloc[j];
}
if (obloc[j] == 2000 + RSLOT)
obimpr[RSLOT] = 9;
obloc[j] = 0;
}
}
}
vdig()
{
int splce, pplce;
if (dobjs[0] != 0 && dobjs[0] != SHOVEL && dobjs[0] != PITCHF)
speak(48);
else if (loc != 73)
speak(284);
else {
itsher(ZSHOVE, &splce);
itsher(ZPITCH, &pplce);
if ((dobjs[0] == SHOVEL && splce != 0) ||
(dobjs[0] == PITCHF && pplce != 0) ||
(dobjs[0] == 0 && (splce > 0 || pplce > 0))) {
if (obimpr[RHOLE] != 17)
speak(283);
else
speak(434);
obimpr[RHOLE] = 17;
} else if ((dobjs[0] == SHOVEL && splce == 0) || (dobjs[0] ==
PITCHF && pplce == 0))
speak(89);
else
speak(234);
}
}
vdrink()
{
int spk;
/* pervert!!!! */
if (dobjs[0] == NPISS) {
dirty += 1;
spk = 183;
}
/* water is o.k. */
else if (dobjs[0] == WATER) {
if ((locdat[loc] & 1024) == 1024)
spk = 184;
else
spk = 74;
} else
spk = 48;
speak(spk);
}
vdrop()
{
int d, i, ambig, ddflg, empty, plce, plural, kkwr, kk, spk;
/* special code for "drop something into bowl" */
if (prepio != 0 && !(prepio == IN && iobj == BOWL)) {
speak(28);
return;
}
/* convert dobjs(1) (noun) list into list of objects (pointers) */
ambig = !cnvobj();
if (allflg)
getall();
for (i = 0; i < 30; i++) {
ddflg = 0;
empty = 1;
d = dobjs[i];
if (d == 0)
continue;
/* see if it is here */
itsher(d, &plce);
if (allflg && ((plce != 1 && plce != 2) || d > MOVMAX))
continue;
if (dobjs[1] != 0 || allflg)
speak(odistb[d]);
plural = (obpprp[d] & 256) == 256;
if (d > MOVMAX)
spk = 48;
else if (plce == 2) {
spk = 88;
if (plural)
spk = 194;
} else if (d == ZWIRE && plce != 1) {
for (kkwr = 0; kkwr < 6; kkwr++)
if (wirelc[kkwr] == 1000)
wirelc[kkwr] = loc;
if (obloc[d] == loc && wirelc[5] == loc) {
for (kkwr = 0; kkwr < 6; kkwr++)
wirelc[kkwr] = 0;
}
spk = 82;
} else if (plce == 0 || plce == 4 || plce == 5) {
spk = 89;
if (plural)
spk = 195;
} else if (d == ZSEED && (wrdnum[0] == DROP || wrdnum[0] == THROW)) {
if (loc == 100) {
spk = 340;
obimpr[ZSEED] = 0;
} else if (loc == 131 || loc == 99) {
spk = 338;
obimpr[ZSEED] = 3;
} else {
obimpr[ZSEED] = 0;
spk = 337;
}
obloc[ZSEED] = 0;
} else if (d == CFISH && obloc[d] ==
(2000 + PLBAG) && (obimpr[PLBAG] / 512 == 5))
spk = 76;
/*
* code for knocking the puck out of the arena loc38 is center of
* bowl, 23-37 are the rim
*/
else if (iobj == BOWL) {
if (loc < 32 || loc > 38)
spk = 156;
else {
if (d == RBOULD && loc != 38) {
itsher(RBOULD, &plce);
/* marflg[1] tells if martians are there */
if (marflg[1]) {
speak(157);
vdead();
oldloc = 0;
oldlc2 = 0;
return;
} else {
if (obloc[HPUCK] == 38) {
/*
* the next line tells if other rim is low or
* high
*/
if ((loc & 1) == 1) {
/* we shoot the puck out */
spk = 158;
obloc[RBOULD] = 38;
obloc[HPUCK] = loc + 3;
if (obloc[HPUCK] > 37)
obloc[HPUCK] -= 6;
} else {
spk = 159;
obloc[RBOULD] = 38;
}
} else {
/* in this case it settles back in */
if ((loc & 1) == 1) {
spk = 160;
obloc[RBOULD] = loc + 3;
if (obloc[RBOULD] > 37)
obloc[RBOULD] -= 6;
} else {
spk = 161;
obloc[RBOULD] = 38;
}
}
/* smash the other items in the bowl */
for (kk = 1; kk <= MOVMAX; kk++) {
if (kk == RBOULD || kk == HPUCK)
continue;
if (obloc[kk] == 38) {
obloc[kk] = 0;
empty = 0;
}
}
}
} else {
spk = 75;
obloc[d] = 38;
ddflg = 1;
}
}
} else {
if (d == ZCAT)
spk = 334;
else if (d == RBOULD)
spk = 335;
else if (d == ZORCHI && loc == 87)
spk = 432;
else if (d == ZFLYTR && loc == 87)
spk = 433;
else
spk = 82;
obloc[d] = loc;
ddflg = 1;
}
if (d == ZLATEX && ddflg == 1)
obimpr[d] = 337;
xindnt += 2;
speak(spk);
xindnt -= 2;
if (empty != 1) {
xindnt += 4;
speak(162);
xindnt -= 4;
}
}
}
veat()
{
int d, l, spk, plce;
/* don't eat shit */
if (dobjs[0] == NSHIT) {
dirty += 1;
spk = 179;
}
/* id love for you to do it, but please don't make mama mad */
else if (dobjs[0] == ME) {
dirty += 1;
spk = 183;
} else {
d = getobj(dobjs[0], doadjs[0]);
/* see if its here */
if (d <= 0) {
speak(48);
return;
}
itsher(d, &plce);
if (plce <= 0) {
spk = 66;
if ((obpprp[d] & 256) == 256)
spk = 185;
} else {
/* poison! */
if ((obpprp[d] & 8) == 8) {
if (d == CFISH && obloc[d] ==
(2000 + PLBAG) && (obimpr[PLBAG] / 512 == 5)) {
speak(76);
return;
}
speak(181);
oldloc = 0;
oldlc2 = 0;
if (d <= MOVMAX)
obloc[d] = 0;
vdead();
return;
}
/* it's edible, and delicious */
else if ((obpprp[d] & 4) == 4) {
spk = 180;
if (d <= MOVMAX)
obloc[d] = 0;
if (d != BBALL)
eattim = 0;
if (d == CEGG) {
spk = 478;
obloc[SCOIN] = 1000;
}
if (d == LETTUC)
eattim = 150;
if (d == BBALL) {
lpill = 1;
spk = 522;
bonus += 5;
dcombi = (qrand() % 31);
if (dcombi == 0)
dcombi = 1;
l = (qrand() % 31);
if (l == 0)
l = 22;
dcombi = dcombi * 32 + l;
l = (qrand() % 31);
if (l == 0)
l = 3;
dcombi = dcombi * 32 + l;
}
/* inedible */
} else
spk = 182;
}
}
speak(spk);
}
vfill()
{
int result, z, z2, spk, i, empty, plce;
result = 0;
z = dobjs[0];
spk = 48;
if (dobjs[0] == FUNNEL && iobj == WATER) {
result = 1;
dobjs[0] = WATER;
iobj = FUNNEL;
ioadj = doadjs[0];
doadjs[0] = 0;
prepio = IN;
return (result);
}
if (dobjs[0] == TUBE) {
speak(494);
return (result);
}
/* fill the bag or bucket with water or latex */
empty = 1;
if (z == BUCKET) {
for (i = 1; i <= OBJMAX; i++)
if (obloc[i] == 2039)
empty = 0;
}
if (z == BUCKET && iobj == LATEX && obloc[ZLATEX] == 66 &&
prepio == WITH && loc == 66) {
if (obimpr[ZBUCKE] == 1033)
spk = 274;
else if (empty == 0)
spk = 275;
else {
obloc[ZLATEX] = 2000 + ZBUCKE;
obimpr[ZBUCKE] = 1545;
obimpr[ZLATEX] = 265;
spk = 75;
}
} else if ((z == BAG && (doadjs[0] == 0 || doadjs[0] == PLASTI)) ||
(z == BUCKET && doadjs[0] == 0)) {
if ((prepio == WITH && iobj == WATER) ||
(((locdat[loc] & 1024) == 1024) && prepio == 0
&& iobj == 0)) {
z2 = ZBUCKE;
if (z == BAG)
z2 = PLBAG;
itsher(z2, &plce);
if (plce == 0)
spk = 73;
else if ((locdat[loc] & 1024) != 1024 && ((obloc[ZBUCKE]
!= loc && obloc[ZBUCKE] != 1000) || obimpr[ZBUCKE]
!= 1033))
spk = 74;
else if (empty == 1) {
if (z2 == PLBAG)
obimpr[z2] = 2697;
else
obimpr[z2] = 1033;
spk = 75;
obloc[z2] = 1000;
} else
spk = 275;
} else if (iobj == 0)
spk = 278;
}
speak(spk);
return (result);
}
vfuck()
{
if (dirty < 10)
speak(495);
else if (dirty > 20)
speak(497);
else
speak(496);
}
vget()
{
int spk, result;
result = 0;
spk = 0;
if (prepdo == IN && dobjs[0] == CHAIR && (loc == 166 ||
loc == 175)) {
spcloc = 2;
spk = 510;
}
/* get up is a joke */
else if (prepdo == UP) {
if (dobjs[0] == 0 && spcloc == 2) {
spk = 511;
spcloc = 0;
} else
spk = 208;
}
/* get on or off glass plate */
else if (dobjs[0] == GLASS && (doadjs[0]
== 0 || doadjs[0] == GLASS) && dobjs[1] == 0) {
if (prepdo == OFF && spcloc == 1) {
spcloc = 0;
spk = 75;
} else if (prepdo == ON && spcloc == 0) {
spcloc = 1;
spk = 75;
}
}
/* get something means take it */
else if (prepdo == ON || prepdo == OFF)
spk = 71;
else
result = 1;
/* this results in calling vtake */
if (spk != 0)
speak(spk);
return (result);
}
vgive()
{
int spk, ij, iplce, dj, dplce;
spk = 0;
if (iobj == ME)
spk = 445;
else if (iobj == GUARD) {
if (loc == guardl || loc == 171 || (chaset != 0 &&
chaset <= 9))
spk = 562;
else
spk = 561;
} else if (iobj == MARTIA) {
if (martim == 7 && loc >= 27 && loc <= 51)
spk = 446;
else
spk = 168;
} else if (iobj == FERRET && !(loc == 131 || loc == 99
|| loc == 100))
spk = 447;
else if (iobj != CAT && iobj != BIRD && iobj != BEES &&
iobj != FROG && iobj != ROBOT)
spk = 448;
else {
ij = getobj(iobj, ioadj);
if (iobj == BIRD && ij < 0)
ij = YBIRD;
itsher(ij, &iplce);
if (iplce == 0) {
if (iobj == CAT)
spk = 449;
else if (iobj == BEES)
spk = 450;
else if (iobj == FROG)
spk = 451;
else if (iobj == ROBOT)
spk = 452;
else if (iobj == BIRD)
spk = 453;
} else {
if (iobj == FROG)
spk = 454;
else if (iobj == BIRD)
spk = 455;
}
}
if (spk != 0) {
speak(spk);
return;
}
dj = getobj(dobjs[0], doadjs[0]);
if (dj < 0)
spk = 70;
else if (dj == 0)
spk = 28;
else {
itsher(dj, &dplce);
if (dplce == 0) {
if ((obimpr[dj] & 256) != 0)
spk = 185;
else
spk = 89;
} else if (obloc[dj] == 2000 + ij)
spk = 456;
else if (dj > MOVMAX)
spk = odistb[dj + 1] - 1;
else if (dplce > 3)
spk = 458;
else;
}
if (spk != 0) {
speak(spk);
return;
}
/* at this point you have it, and someone is here to take it. */
if (iobj == CAT) {
if (dobjs[0] == FISH) {
spk = 459;
obloc[dj] = 0;
} else if ((obpprp[dj] & 12) != 0)
spk = 460;
else
spk = 461;
} else if (iobj == FERRET) {
if (dobjs[0] == EGG || dobjs[0] == FISH || dobjs[0] == CAT) {
spk = 462;
obloc[dj] = 0;
} else if ((obpprp[dj] & 12) != 0)
spk = 464;
else {
spk = 463;
obloc[dj] = 0;
}
} else if (iobj == BEES) {
if (iobj != ORCHID && iobj != FLYTRA)
spk = 465;
else if (iobj == ORCHID) {
spk = 432;
obloc[dj] = loc;
} else {
spk = 433;
obloc[dj] = loc;
}
} else if (iobj == ROBOT) {
if (obloc[ZCART] != RSLOT + 2000 && obloc[CCART] != RSLOT + 2000)
spk = 466;
else if (obw3[dj] / 256 > 1 || (obw3[dj] & 255) > 2)
spk = 352;
else {
spk = 345;
obloc[dj] = 2000 + ZROBOT;
}
}
speak(spk);
}
vhelp()
{
speak(105);
}
vkiss()
{
int result, spk, cplce;
/* if vkiss ends up 1, call vpush */
result = 0;
if (dobjs[0] == FROG && loc == 67)
spk = 468;
else if (dobjs[0] == GUARD) {
if (loc == guardl || loc == 171 || (chaset != 0 && chaset <= 9))
spk = 562;
else
spk = 561;
} else if (dobjs[0] == FERRET && (loc == 131 || loc == 100 || loc == 99))
spk = 469;
else if (dobjs[0] == CAT) {
itsher(ZCAT, &cplce);
if (cplce != 0)
spk = 470;
else
spk = 449;
} else if (dobjs[0] == ME)
spk = 471;
else if (dobjs[0] == BIRD || dobjs[0] == BEES || dobjs[0] == ROBOT)
spk = 472;
else
result = 1;
if (result == 0)
speak(spk);
return (result);
}
vlocks()
{
int n, plce, spk;
n = getobj(dobjs[0], doadjs[0]);
if (n < 0)
spk = 70;
else if (n == 0)
spk = 28;
else if ((obpprp[n] & 512) != 512 && n != ZBOX)
spk = 233;
else {
itsher(n, &plce);
if (plce <= 0) {
if (dobjs[0] == DOOR)
spk = 225;
else
spk = 66;
} else if (n == ZBOX)
spk = 389;
else if (n == ODOOR || n == PDOOR)
spk = 524;
else if (prepio == WITH && iobj == KEY) {
if (n == RDOOR || (n == MDOOR && loc == 41))
spk = 235;
else if (n == MDOOR || n == GDOOR) {
if (wrdnum[0] == LOCK)
obimpr[n] |= 4;
else
obimpr[n] = (obimpr[n] & ~4);
/* ~4=177773 octal */
spk = 75;
} else
spk = 48;
} else
spk = 234;
}
speak(spk);
}
static char strng3[] = "The left dial is set to and the right to .";
static char strng4[] = "are for the left and for the right.";
vlooks()
/*
* look or examine
*/
{
char cnum[4];
int kk, zplce, spk, kkwr, lwire, n, plce, u, empty;
if ((prepdo == THROUG && dobjs[0] == TELESC && wrdnum[0] ==
LOOK) || (wrdnum[0] == EXAMIN && dobjs[0] == PLANET &&
prepio == WITH && iobj == TELESC)) {
if (loc >= 175 && loc <= 181)
spk = loc + 326;
else if (loc == 184 || loc == 187)
spk = 507;
else
spk = 48;
speak(spk);
return;
}
if ((loc >= 43 && loc <= 45) && (dobjs[0] == HOLE || dobjs[0]
== DOOR)) {
if (daytim == 1)
speak(173);
else
speak(174);
return;
}
if (dobjs[0] == HOUSE && (doadjs[0] == 0 || doadjs[0] == DOLL)
&& prepdo == IN) {
if (loc != 132)
speak(481);
else if (obimpr[CEGG] > 4096) {
speak(479);
obloc[CEGG] = 132;
} else
speak(480);
return;
}
/* you can't examine things at night unless they glow */
if (daytim == 0 && dobjs[0] != SPHERE) {
speak(120);
return;
}
if (wrdnum[0] == EXAMIN)
prepdo = AT;
if (dobjs[0] == TELESC) {
if ((loc >= 175 && loc <= 181) || loc == 184 || loc == 187)
speak(534);
else
speak(535);
return;
}
/* if you look behind horsetails, there is a cave */
if (prepio == 0 && prepdo == BEHIND && loc == 169 &&
dobjs[0] == CABINE) {
speak(523);
return;
}
if (prepio == 0 && prepdo == BEHIND && loc == 24) {
if (dobjs[0] == HORSET) {
speak(119);
horflg = 1;
return;
} else if (dobjs[0] == WATERF) {
speak(493);
horflg = 1;
return;
}
}
/*
* in the (hockey) bowl you can only see if something is there, not what
* it is
*/
if (prepdo == IN && dobjs[0] == BOWL && (loc >= 32 && loc <= 37)) {
empty = 1;
for (kk = 1; kk <= MOVMAX; kk++)
if (obloc[kk] == 38)
empty = 0;
if (empty == 1)
speak(7);
else
speak(163);
return;
}
if ((loc == 28) && (dobjs[0] == STOOLS || dobjs[0] == STOOL ||
dobjs[0] == BOWL) && (doadjs[0] == 0 || doadjs[0] == CERAMI)) {
speak(176);
return;
}
/* various martian things */
if (loc == 42 && (dobjs[0] == STOOLS || dobjs[0] == BOWL)) {
speak(177);
spcloc = 0;
return;
}
if (loc == 30 && (dobjs[0] == BUILDI || dobjs[0] == WINDOW)
&& prepdo == IN) {
speak(174);
return;
}
if (dobjs[0] == CACTUS && loc == 82 && wrdnum[0] == EXAMIN) {
if (pct(25) && (cactsc & 2) == 0) {
speak(371);
cactsc += 2;
if (cactsc == 3)
speak(439);
} else if ((cactsc & 1) == 0) {
speak(370);
cactsc += 1;
if (cactsc == 3)
speak(439);
} else
speak(237);
return;
}
if (dobjs[0] == DIAL) {
itsher(ZBOX, &zplce);
if (zplce == 0)
speak(388);
else {
numcvt(dial1, cnum);
strng3[24] = cnum[1];
strng3[25] = cnum[2];
strng3[26] = cnum[3];
numcvt(dial2, cnum);
strng3[45] = cnum[1];
strng3[46] = cnum[2];
strng3[47] = cnum[3];
linout(strng3, 49);
}
return;
}
/*
* special code for anything other than "look at object" or "look in
* container" gotes above here
*/
n = getobj(dobjs[0], doadjs[0]);
if (prepio != 0 || (prepdo != AT && prepdo != IN)) {
speak(94);
return;
}
if (n == 0) {
speak(95);
return;
} else if (n < 0) {
speak(70);
return;
}
itsher(n, &plce);
lwire = 0;
/* special code for wire in several places at once */
if (n == ZWIRE) {
for (kkwr = 0; kkwr < 6; kkwr++)
if (wirelc[kkwr] == loc)
lwire = 1;
}
if (plce < 1 && !lwire) {
if ((obpprp[n] & 256) == 256)
speak(185);
else
speak(66);
return;
}
if (plce < 1 && n == ZWIRE && lwire) {
speak(215);
return;
}
/* the generic "look at" processor */
if (prepdo == AT) {
u = (obimpr[n] / 64 % 8);
if (u == 0) {
if ((obpprp[n] & 256) == 256)
speak(193);
else
speak(96);
}
/* zzzzzzap if not standing on glass while looking at knob */
else if ((n == ZSTOOL || n == ZKNOB) && spcloc == 1)
speak(237);
else if (n == ZANTEN) {
if (obloc[DCABLE] == 2000 + ZANTEN) {
speak(odistb[n] + 1);
obimpr[DCABLE] = 137;
} else if (obloc[GCABLE] == 2000 + ZANTEN)
speak(odistb[n] + 2);
else
speak(odistb[n] + 3);
} else {
if ((n == MMAP || n == NNEWS || n == TMACH || n == NNOTE
) && loc >= 153 && lpill == 1)
u += 1;
speak(odistb[n] + u);
if (n == NNOTE && lpill == 1)
nreadx();
if (n == ZSCREE && obimpr[n] == 145 && loc == 146)
robdsc();
if (dobjs[0] == BOX) {
numcvt(dial1, cnum);
strng3[24] = cnum[1];
strng3[25] = cnum[2];
strng3[26] = cnum[3];
numcvt(dial2, cnum);
strng3[45] = cnum[1];
strng3[46] = cnum[2];
strng3[47] = cnum[3];
linout(strng3, 49);
}
if (dobjs[0] == FILM && obimpr[ZFILM] == 201) {
wwflag = 1;
speak(odistb[fimage]);
wwflag = 0;
outst2[0] |= 32;
outst2[kmax] = '.';
outst2[kmax+1] = '\0';
linout(outst2, kmax+1);
if (fimage == ZBOX) {
speak(404);
numcvt(dial1x, cnum);
strng4[4] = cnum[1];
strng4[5] = cnum[2];
strng4[6] = cnum[3];
numcvt(dial2x, cnum);
strng4[25] = cnum[1];
strng4[26] = cnum[2];
strng4[27] = cnum[3];
linout(strng4, 49);
}
}
/*
* special code for flags set by looking at or in object goes
* below here
*/
if (n == PPHOTO)
horflg = 1;
}
}
if (obpprp[n] / 2048 != 0)
xcontn(n);
else if (prepdo == IN)
speak(97);
return;
}
vopen()
{
int spk, n, plce;
if (prepdo != 0 && prepio != 0)
spk = 21;
/* there is no door on the bar to open or close */
else if ((loc == 30 || loc == 42) && dobjs[0] == DOOR)
spk = 224;
/* open doors or containers */
else {
n = getobj(dobjs[0], doadjs[0]);
if (dobjs[0] == DOOR && (loc == 184 || loc == 187 ||
(loc >= 176 && loc <= 181)))
n = BDOOR;
if (n < 0)
spk = 70;
else if (n == 0)
spk = 66;
/* if they can be opened */
else if ((obpprp[n] % 2) != 1) {
if (obpprp[n] / 2048 != 0)
spk = 254;
else
spk = 230;
} else {
itsher(n, &plce);
if (dobjs[0] == DOOR && (loc == 184 || loc == 187 ||
(loc >= 176 && loc <= 181)))
plce = 5;
if (plce <= 0) {
if (dobjs[0] == DOOR)
spk = 225;
else
spk = 66;
}
/* and aren't locked ,but are closed */
else if ((obimpr[n] & 4) == 4) {
if (n == ZBOX)
spk = 389;
else
spk = 228;
} else if ((obimpr[n] & 2) == 0)
spk = 226;
else if (dobjs[0] == DOOR && (loc <= 180 && loc >= 176))
spk = 546;
else if (dobjs[0] == CABINE && adverb != CAREFU && adverb !=
QUIETL)
spk = 553;
else {
spk = 231;
obimpr[n] = (obimpr[n] & ~2);
/* ~2=177775 octal */
if (n == RDOOR || n == MDOOR || n == GDOOR || n ==
ODOOR || n == BDOOR)
obimpr[n] += 8;
if (n == ZDESK && dial1x == -1) {
/*
* establish the proper setting of the dials when the box
* is first seen
*/
dial1x = (qrand() % 999) + 1;
dial2x = (qrand() % 999) + 1;
}
}
}
}
speak(spk);
if (spk == 553)
vdead();
}
vpick()
{
int result;
result = 0;
/* pick up means take */
if (prepdo == UP) {
prepdo = 0;
result = 1;
}
/* this results in calling take */
else if (dobjs[0] == NLOCK && loc == 47)
speak(235);
else
speak(95);
return(result);
}
vpiss()
{
dirty += 1;
{
if (loc == 74 && (obimpr[ZVINE] & 56) == 8 && (dobjs[0]
== 0 || dobjs[0] == VINE)) {
speak(301);
obimpr[ZVINE] += 8;
} else if (dirty >= 5 && dirty < 10)
speak(40);
else if (dirty >= 10) {
if (obloc[LPANT] == 3000 || obloc[RPANT] == 3000)
speak(41);
else
speak(42);
}
}
}
vpour()
{
int result, bplce, pplce, n, plce;
result = 0;
/* if result set = 1, then call vput */
if (wrdnum[0] == QWATER) {
prepio = ON;
iobj = dobjs[0];
ioadj = doadjs[0];
dobjs[0] = WATER;
doadjs[0] = 0;
}
if (dobjs[0] == DEET && prepio == ON && (iobj == ME
|| (iobj == VINE && loc == 74))) {
itsher(ZDEET, &plce);
if (plce == 0)
speak(66);
else {
speak(75);
obimpr[ZDEET] = 28762;
obloc[ZDEET] = 0;
}
return (result);
}
if ((dobjs[0] == DEET || dobjs[0] == METOL || dobjs[0] == HYPO)
&& iobj == FUNNEL) {
wrdnum[0] = PUT;
prepio = IN;
result = 1;
return (result);
}
if (iobj != 0 && iobj != POLE) {
n = getobj(iobj, ioadj);
if (n >= 0) {
itsher(n, &plce);
}
if (iobj == FUNNEL && n < 0) {
speak(70);
return (result);
}
if (n <= 0 || plce == 0) {
speak(48);
return (result);
}
}
itsher(ZBUCKE, &bplce);
itsher(PLBAG, &pplce);
if (dobjs[0] == WATER) {
if (bplce != 0 && obimpr[ZBUCKE] == 1033) {
if (iobj == FUNNEL) {
if (n == LFUNNE || n == RFUNNE) {
speak(402);
if (obimpr[RLIGHT] != 73) {
speak(400);
obimpr[RLIGHT] = 73;
obimpr[GLIGHT] = 73;
}
machst |= machst;
return(result);
} else {
if ((machst & 2) == 0)
speak(397);
machst |= 2;
obimpr[ZINDIC] = 145;
if ((machst & 16) != 0 && (machst & 1) == 0 &&
obimpr[RLIGHT] == 73) {
speak(399);
obimpr[RLIGHT] = 145;
obimpr[GLIGHT] = 145;
}
}
} else if (loc != 74 || (obimpr[ZVINE] & 56) != 8)
speak(247);
else {
speak(301);
obimpr[ZVINE] = obimpr[ZVINE] + 8;
}
obimpr[ZBUCKE] = 1545;
} else if (pplce != 0 && obimpr[PLBAG] == 2697)
speak(248);
else
speak(48);
} else if (dobjs[0] == LATEX && obloc[ZLATEX] == 2000 + ZBUCKE
&& bplce != 0 && (obimpr[ZLATEX] & 56) == 8) {
if (loc != 76 || iobj != POLE) {
speak(279);
obimpr[ZLATEX] = obimpr[ZLATEX] + 72;
} else {
speak(75);
obimpr[ZLATEX] = obimpr[ZLATEX] + 80;
}
obloc[ZLATEX] = loc;
} else
speak(48);
return (result);
}
vpush()
{
int result, numbr, ndo, nio, spk, xfilm;
result = 0;
/* push is also touch */
if ((loc == 165 || loc == 173) && dobjs[0] > 9999) {
numbr = dobjs[0] - 10000;
if ((loc == 165 && numbr > 30) || (loc == 173 && numbr > 99))
speak(532);
else if (loc == 165) {
pbstat = (pbstat & 1023) * 32 + numbr;
if (pbstat == dcombi) {
speak(530);
/* ~4=177773 octal */
obimpr[ODOOR] = (obimpr[ODOOR] & ~4);
} else
speak(238);
} else
speak(238);
return (result);
}
if (dobjs[0] == CACTUS && loc == 82) {
if (pct(25) && (cactsc & 2) == 0) {
speak(371);
cactsc = cactsc + 2;
if (cactsc == 3)
speak(439);
} else if ((cactsc & 1) == 0) {
speak(370);
cactsc = cactsc + 1;
if (cactsc == 3)
speak(439);
} else
speak(237);
return (result);
}
if (dobjs[0] == GUARD) {
if (loc == guardl || loc == 171 || (chaset != 0 && chaset <= 9))
speak(562);
else
speak(561);
return (result);
}
ndo = 0;
nio = 0;
if (dobjs[0] != 0)
ndo = getobj(dobjs[0], doadjs[0]);
if (iobj != 0)
nio = getobj(iobj, ioadj);
/*
* unlocking the door to warehouse by touching wire to it if wire is
* connected to knob in bar
*/
if ((ndo == MDIMPL && nio == ZWIRE && prepio == WITH) ||
(ndo == ZWIRE && nio == MDIMPL && prepio == TO) &&
loc == 47) {
if (obloc[ZWIRE] != loc && wirelc[0] != loc && wirelc[1] !=
loc && wirelc[2] != loc && wirelc[3] != loc &&
wirelc[4] != loc && wirelc[5] != 1000 && obloc[ZWIRE]
!= 1000)
spk = 213;
/* first test is for connection to knob */
else if (((obimpr[ZWIRE] / 8) % 8) == 4 && (wirelc[5] == 1000
|| wirelc[5] == loc)) {
spk = 238;
/* ~4=177773 octal */
obimpr[RDOOR] = (obimpr[RDOOR] & ~4);
} else
spk = 237;
} else if ((ndo == ZKNOB || nio == ZKNOB) && loc == 42 && spcloc != 1)
spk = 207;
else if (ndo == ZLOUVE && (loc == 98 || loc == 142) &&
obimpr[ZLOUVE] == 1) {
spk = 282;
obimpr[ZLOUVE] = 9;
} else if (dobjs[0] == BUTTON) {
if (ndo == -1)
spk = 70;
else if (ndo == SBUTTO && loc == 146) {
locdat[144] |= 16;
locdat[145] |= 16;
locdat[147] |= 16;
locdat[148] |= 16;
locdat[150] |= 16;
spk = 238;
} else if (ndo == RBUTTO && loc == 146) {
speak(383);
result = 1;
return(result);
} else if (ndo == HBUTTO && loc == 146) {
if (easttm == 0)
easttm = 1;
spk = 238;
} else if (ndo == TBUTTO && loc == 146) {
if (easttm == 51)
easttm = 52;
spk = 238;
} else if (ndo == GBUTTO && loc == 169) {
if (adverb == TWICE) {
spk = 525;
obimpr[HMURAL] = 209;
bonus = bonus + 5;
chaset = 1;
oldlc2 = 0;
oldloc = 0;
} else
spk = 238;
} else if (ndo == RDBUTT && loc == 143) {
if ((machst & 51) != 18)
spk = 237;
else {
speak(398);
xfilm = (filmtm % 1000);
if (xfilm >= 3 && xfilm <= 6 && filmtm < 2000 && machst == 30) {
if (filmst == 0)
obimpr[ZFILM] = obimpr[ZFILM] + 64;
else
obimpr[ZFILM] = obimpr[ZFILM] + 128;
} else if ((machst & 12) != 12)
obimpr[ZFILM] = obimpr[ZFILM] + 192;
else;
obloc[ZFILM] = 2000 + ZHOPPE;
machst = 33;
return (result);
}
} else if (loc == 134 && (ndo == VBUTTO || ndo == OBUTTO ||
ndo == WBUTTO || ndo == BBUTTO)) {
if (obloc[GDISC] == 2000 + ZRECES && rvtim != 2)
spk = 411;
else if (obloc[GDISC] == 2000 + ZRECES && rvtim == 2 &&
obloc[GCABLE] != 2000 + ZANTEN)
spk = 421;
else if (obloc[GDISC] == 2000 + ZRECES && rvtim == 2) {
if (ndo == VBUTTO) {
spk = 415;
result = 2;
} else if (ndo == OBUTTO) {
spk = 416;
result = 3;
} else if (ndo == BBUTTO) {
spk = 417;
result = 4;
} else {
spk = 418;
result = 5;
}
} else
spk = 238;
} else
spk = 419;
} else
spk = 236;
speak(spk);
return (result);
}
SHAR_EOF
# End of shell archive
exit 0
--
Bob Page, U of Lowell CS Dept. page@swan.ulowell.edu ulowell!page
Have five nice days.